Using a Combo Box to Select a Screen

The following example walks through the creation of a simple screen that includes a combo box for selecting different screen files, and a button to launch the selected screen. It demonstrates how to add elements to a combo box in Edit mode and change the screen displayed by a Hyperlink button in Run mode.

Using a Combo Box to Enable Screen Selection and Launch

  1. Open a new Studio file and add a Combo Box Combo Box to the View. Set its (ObjectCode) property to "cboViews."
  2. Click the value field of the ListItems property to open the List Choices dialog box. Click the Add button to create a list item. Change the text in the Name field to "Alarms" and leave the default value in the Value field.
  3. Click the Add button two more times to create two new list items, and fill in the names as shown below, leaving the default values.

List Choices

List Choices

  1. Click OK in the dialog box.
  2. Change the combo box’s NumDropped property to 3 to drop all three items in the menu.
  3. Click the button tool Button tool in the object bar, then click TheView next to the combo box to place a button.
  4. In the button’s properties, change the (ObjectCode) to "btnGo."
  5. Change the button’s Text property to "Go."
  6. Ensure that HyperLink is selected in the button’s [ButtonType] property.
  7. If you want, use the text tool Text Tool to create a label above the combo box to read "Select a view."  The screen will look something like the one below.

Select a view

Select a View

  1. Double-click the combo box to open the script editor. Navigate to the cboViews EventChange event.
  2. Enter the script as shown below. Change the names and locations of the screen files (here loaded from a fictitious MYSITE.BSS Blob) to match screens on your system.
Copy
Select Screen
Sub cboViews_EventChange()
Dim This : Set This = cboViews
    Select Case This.Value
        Case 0:
            btnGo.FilePath = "MYSITE.BSS\SCREENS\Alarms.csf "
        Case 1:
            btnGo.FilePath = "MYSITE.BSS\SCREENS\Trend.csf"
        Case 2:
            btnGo.FilePath = "MYSITE.BSS\SCREENS\SiteData.csf"
    End Select
End Sub
  1. Switch to Run mode. Try selecting a view name from the combo box and ensure that the Go button displays a different screen based on the selection.

Back to top